package printlog

import (
	"gitee.com/zhongguo168a/gocodes/myx/logx/iface"
)

func NewLogger() (obj *Logger) {
	obj = &Logger{}
	return
}

type Logger struct {
	Name string
}

func (l *Logger) println(a ...interface{}) {
	for _, ival := range a {
		switch v := ival.(type) {
		case string:
			println(v)
		case int:
			println(v)
		case int8:
			println(v)
		case int16:
			println(v)
		case int32:
			println(v)
		case int64:
			println(v)
		case uint:
			println(v)
		case uint8:
			println(v)
		case uint16:
			println(v)
		case uint32:
			println(v)
		case uint64:
			println(v)
		case float32:
			println(v)
		case float64:
			println(v)
		case bool:
			println(v)
		}
	}
}

func (l *Logger) Ok(a ...interface{}) {
	print("[ok   ] ")
	l.println(a...)
}

func (l *Logger) Fail(a ...interface{}) {
	print("[fail ] ")
	l.println(a...)
}

func (l *Logger) Msg(a ...interface{}) {
	l.println(a...)
}

func (l *Logger) Debug(a ...interface{}) {
	print("[debug] ")
	l.println(a...)
}

func (l *Logger) Warn(a ...interface{}) {
	print("[warn ] ")
	l.println(a...)
}
func (l *Logger) Info(a ...interface{}) {
	print("[info ] ")
	l.println(a...)
}

func (l *Logger) Error(a ...interface{}) {
	print("[error] ")
	l.println(a...)
}

func (l *Logger) Fatal(a ...interface{}) {
	print("[fatal] ")
	l.println(a...)
}

func (l *Logger) With(m map[string]interface{}) iface.ILogger {
	return l
}
